<template>
  <div id='DetailGoodsInfo' class='DetailGoodsInfo' v-if="Object.keys(goodsInfo).length !== 0">
    <div class="goods-desc" v-if="goodsInfo.detailImage[0].key">
      <p>{{goodsInfo.desc}}</p>
      <p class="infoTitle">{{goodsInfo.detailImage[0].key}}</p>
    </div>
    <div class="goodsImage">
      <img v-for="(item,index) in goodsInfo.detailImage[0].list" :key="index" :src="item" alt="" srcset=""
        @load="imageLoad">
    </div>
  </div>
</template>

<script>
  export default {
    name: 'DetailGoodsInfo',
    props: { // 父辈向子辈传参
      goodsInfo: {
        type: Object,
        default () {
          return {}
        }
      }
    },
    components: { // 组件的引用

    },
    data() {
      return {

      }
    },
    methods: { // 方法
      imageLoad() {
        // this.$bus.$emit("detailItemImgLoad")
        this.$emit("detailImgLoad")
      }

    },
    computed: { // 计算属性

    },
    created() { // 实例被创建之后执行代码

    },
    mounted() { // 页面进入时加载内容

    },

    watch: { // 监测变化

    }
  }

</script>
<style scoped>
  .DetailGoodsInfo {


    margin-top: 10px;
    color: rgb(85, 85, 85);
  }

  .goods-desc {
    padding: 15px;
  }

  .goodsImage img {
    width: 100%;
    height: 100%;
  }

  .infoTitle {
    color: black;
    margin-top: 20px;
  }

</style>
